<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="shortcut icon" href="favicon.ico"> <link href="./src/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
        <link href="./src/css/font-awesome.css?v=4.4.0" rel="stylesheet">
        <link href="./src/css/plugins/iCheck/custom.css" rel="stylesheet">
        <link href="./src/css/animate.css" rel="stylesheet">
        <link href="./src/css/style.css?v=4.1.0" rel="stylesheet">
        <link href="./src/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
        <script src="./src/js/My97DatePicker/WdatePicker.js"></script>
    </head>
    <body>
        <div class="ibox-content">
            <form class="form-horizontal">
                <input type="hidden" name="m" value="finance">
                <input type="hidden" name="a" value="expatriate">
                <div class="form-group">
                    <label class="col-sm-1 control-label" style="width: 100px;">公司信息：</label>

                    <div class="col-sm-2">
                        <select class="form-control m-b" style="padding-top:2px;">
                            <option value='0'>什么鬼</option>
                        </select>
                    </div>
                    <label class="col-sm-1 control-label" style="width: 100px;">业务类型：</label>

                    <div class="col-sm-2">
                        <select class="form-control m-b" name="servicemode" style="padding-top:2px;">
                            <option value='0'>全部</option>
                            <?php foreach ($this->servicemode as $k => $v) { ?>
                                <option value="<?php echo $v['id'] ?>" <?php echo($this->servicemode_id == $v['id']) ? 'selected' : '' ?> ><?php echo $v['servicemode'] ?></option>
                            <?php } ?>
                        </select>
                    </div>
                    <label class="col-sm-1 control-label" style="width: 125px;">销账状态：</label>

                    <div class="col-sm-2">
                        <select class="form-control m-b" style="padding-top:2px;">
                            <option value='0' >什么鬼</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-1 control-label" style="width: 100px;">车队：</label>

                    <div class="col-sm-2">
                        <select class="form-control m-b" name="carteam_id" style="padding-top:2px;">
                            <option value='0' >全部</option>
                            <?php foreach ($this->carteam as $k => $v) { ?>
                                <option value="<?php echo $v['id'] ?>" <?php echo ($this->carteam_id == $v['id']) ? 'selected' : '' ?> ><?php echo $v['nickname'] ?></option>
                            <?php } ?>
                        </select>
                    </div>
                    <label class="col-sm-1 control-label" style="width: 100px;">车牌：</label>

                    <div class="col-sm-2">
                        <select class="form-control m-b" name="car_id" style="padding-top:2px;">
                            <option value='0'>全部</option>
                            <?php foreach ($this->car as $k => $v) { ?>
                                <option value="<?php echo $v['id'] ?>" <?php echo ($this->car_id == $v['id']) ? 'selected' : '' ?> ><?php echo $v['name'] ?></option>
                            <?php } ?>
                        </select>
                    </div>
                    <label class="col-sm-1 control-label"  style="width: 125px;">司机：</label>

                    <div class="col-sm-2">
                        <select class="form-control m-b" name="driver_id"  style="padding-top:2px;">
                            <option value='0'>全部</option>
                            <?php foreach ($this->driver as $k => $v) { ?>
                                <option value="<?php echo $v['id'] ?>" <?php echo ($this->driver_id == $v['id']) ? 'selected' : '' ?> ><?php echo $v['name'] ?></option>
                            <?php } ?>
                        </select>
                    </div>

                    <!--                    <div class="col-sm-1">
                                            <button class="btn btn-sm btn-info" type="submit">搜索</button>
                                        </div>-->
                </div>
                <label class="col-sm-1 control-label" style="width: 100px;margin-left:-15px;">做箱时间：</label>
                <div class="form-group">
                    <div class="col-sm-4">
                        <div class="input-daterange input-group  m-b"  id="datepicker">
                            <input class="input-sm form-control" name="start" onfocus="WdatePicker({skin: 'whyGreen', dateFmt: 'yyyy-MM-dd'})" value="<?php echo $this->start ?>" type="text">
                            <span class="input-group-addon">到</span>
                            <input class="input-sm form-control" name="end" onfocus="WdatePicker({skin: 'whyGreen', dateFmt: 'yyyy-MM-dd'})" value="<?php echo $this->end ?>"  type="text">
                        </div>
                    </div>
                    <div class="col-sm-1">
                        <button class="btn btn-sm btn-info" type="submit">搜索</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="row">
            <div class="ibox float-e-margins" style="width:98%;margin-left:1%;">
                <div class="ibox-title">
                    <button class="btn btn-success" style="margin-top:-10px;" type="button" id=""><span class="bold">预览</span></button>
                    <button class="btn btn-success" style="margin-top:-10px;" type="button" id="dao"><span class="bold">导出</span></button>    
                    <button class="btn btn-success" style="margin-top:-10px;" type="button" id=""><span class="bold">自定义</span></button>    
                </div>
                <div class="ibox-content">

                    <table class="table table-bordered">
                        <thead>
                            <tr>
                                <th>序号</th>
                                <th>日期</th>
                                <th>门点</th>
                                <th>提单号</th>
                                <th>箱号</th>
                                <th>箱型</th>
                                <th>车牌号</th>
                                <th>提柜点</th>
                                <th>装卸点</th>
                                <th>还柜点</th>
                                <th>司机</th>
                                <th>车队</th>
                                <th>运费</th>
                                <th>扣除代垫费</th>
                                <th>扣除预付费</th>
                                <th>扣除税金</th>
                                <th>小计</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php 
                            $money_1_sum = 0;
                            $money_13_sum = 0;
                            $money_14_sum = 0;
                            $money_15_sum = 0;
                            $total_sum = 0;
                            foreach ($this->object as $k => $v) { ?>
                                <tr>
                                    <td><?php echo $v['id'] ?></td>
                                    <td><?php echo $v['createtime'] ?></td>
                                    <td><?php echo $v['custom_site_id'] ?></td>
                                    <td><?php echo $v['lading_code'] ?></td>
                                    <td><?php echo $v['box_code'] ?></td>
                                    <td><?php echo $v['box_id'] ?></td>
                                    <td><?php echo $v['car_id'] ?></td>
                                    <td><?php echo $v['send_yard_id'] ?></td>
                                    <td><?php echo $v['goods_city']; ?></td>
                                    <td><?php echo $v['back_yard_id']; ?></td>
                                    <td><?php echo $v['driver_id']; ?></td>
                                    <td><?php echo $v['car_team_id']; ?></td>
                                    <td><?php echo $v['money_1'];$money_1_sum += $v['money_1']; ?></td>
                                    <td><?php echo $v['money_13'];$money_13_sum += $v['money_13']; ?></td>
                                    <td><?php echo $v['money_14'];$money_14_sum += $v['money_14']; ?></td>
                                    <td><?php echo $v['money_15'];$money_15_sum += $v['money_15']; ?></td>
                                    <td><?php echo $v['total']; $total_sum += $v['total']; ?></td>
                                </tr>
                            <?php } ?>
                                <tr style='background:#CEDFF5'>
                                    <td colspan="12" style='text-align:right;'><b>合计:</b></td>
                                    <td><?php echo $money_1_sum; ?></td>
                                    <td><?php echo $money_13_sum; ?></td>
                                    <td><?php echo $money_14_sum; ?></td>
                                    <td><?php echo $money_15_sum; ?></td>
                                    <td><?php echo $total_sum; ?></td>
                                </tr>
                                <tr style="background:#CEDFF5">
                                    <td colspan="12" style='text-align:right;'><b>合计大写:</b></td> 
                                    <td colspan="5"><?php echo get_amount($total_sum); ?></td>
                                </tr>
                        </tbody>
                    </table>

                </div>
            </div>
        </div>
        <div class="admin-table-page" style="margin-left:20px;">
            <div id="page" class="page">
                <?php echo $this->paging; ?>
            </div>
        </div>
        <script src="./src/js/jquery.min.js?v=2.1.4"></script>
        <script src="./src/js/bootstrap.min.js?v=3.3.6"></script>



        <!-- 自定义js -->
        <script src="./src/js/content.js?v=1.0.0"></script>
        <script src="./src/js/plugins/sweetalert/sweetalert.min.js"></script>
        <script>
        $(function(){
            $("#dao").click(function(){
                location.href = "./?m=finance&a=expatriate&type=2";
            });
        });
        </script>
    </body>
</html>
